package com.xzp.blog.service.impl;

import com.xzp.blog.entity.About;
import com.xzp.blog.entity.dto.form.AboutModifyForm;
import com.xzp.blog.mapper.AboutMapper;
import com.xzp.blog.service.IAboutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AboutServiceImpl implements IAboutService {

    @Autowired
    private AboutMapper aboutMapper;

    @Override
    public About getAbout() {
        return aboutMapper.selectAll().get(0);
    }

    @Override
    public void updateAbout(AboutModifyForm form, About about) {
        about.setId(1);
        about.setHtmlMaterial(form.getHtmlMaterial());
        about.setMdMaterial(form.getMdMaterial());
        aboutMapper.updateByPrimaryKeySelective(about);
    }
}
